Displaying Images from a Table

Description

A field in a table may contain an image or the file location of an image (an image reference field). This example shows how to display these two types of images.

Preparing the Data

The "Web_Applications_Demo" database is located in the Samples folder under the Alpha Anywhere installation folder. This example uses a series of high resolution images that are located in the Samples\WebAppServerDemo\Hires folder under the Alpha Anywhere installation folder.

  1. In the Web Projects Control Panel right click and select New Folder.

  2. Name the folder "Hires" and click OK.

  3. Use Windows Explorer to copy the files in the Samples\WebAppServerDemo\Hires folder to the new Hires folder under your webproject folder.

Creating the Grid Component

  1. Create a new grid component based on the Flowers table.

  2. On the Component Type page check Grid contains a 'Detail View' part.

  3. On the Grid > Fields menu add the "Id", "Imagedate", "Keywords", "Thumbnail", and "Description" fields to the grid.

  4. Select the "Id" field in the Selected Fields list.

    • 1. Change its Display Settings > Control type to "Link".

    • 2. Change its Link Properties > Display what in link field to "Value from other field(s)".

    • 3. Click the '...' button in the Link Properties > Field(s) to display field display the Link Display Value dialog.

    • 4. Select "{Thumbnail}" and double click.

    • 5. Change its Link Properties > Link address type field to "Detailview link".

    • 6. Change the Column Properties > Column heading field to "Select".

  5. Select the "Thumbnail" field in the Selected Fields list.

    • Change the Column Properties > Hide column field to "True".

    • Change its Display Settings > Control type to "Image".

    • Click the '...' button in the Image Properties > In-line Style field display the Style Editor dialog.

    • Display the Edges tab, set the Borders> Width field to 0, and click OK.

  6. Select the "Imagedate" field in the Selected Fields list and change its Column Properties > Column heading field to "Date".

  7. Display the Detail View > Properties menu.

  8. Select "Id" in the Detail view hyperlink field > Hyperlink field list.

  9. Display the Detail View > Fields menu.

  10. Move "Id" and "Picture" fields to the Selected Fields list.

  11. Select the "Id" field in the Selected Fields list. Check its Row Properties > Hide row field.

  12. Select the "Picture" field in the Selected Fields list. Change its Display Settings > Control type to "Image".

  13. Display the Grid > Properties menu.

  14. Select "BlueMoon" in the Style drop-down list box.

  15. Click Live Preview at the bottom of the Grid Builder. Note that the text is vertically centered in the table cells.

  16. Version 6

    To make the text in the table cells top align:

    • Click Edit Style to display the Webform Style Builder.

    • Right click on the table cell that contains "ABMS" and click Edit .BlueMoonDataTD.

    • Display the Text tab.

    • In the Alignment Vertical list select "top".

    • Click OK.

    • Click the following icon to close the Webform Style Builder.

      images/Close_Script_Button.gif
  17. Version 7

    To make the text in the table cells top align:

    • Click Edit Style to display the Webform Style Builder.

    • Click Edit to the right of "Core Style".

    • Right click on the table cell that contains "ABMS" and click Edit .BlueMoonDataTD.

    • Display the Text tab.

    • In the Alignment Vertical list select "top".

    • Click OK.

    • Click the following and Yes to close the Webform Style Builder.

      images/Close_Script_Button.gif
  18. Display the Detail View > Properties menu.

  19. Select "False" in the Title > Show row labels list (de-select the check box).

  20. Save the grid as "FlowerGrid".

  21. Click Browser. When you click on a thumbnail, the detail view will appear with the larger image. The result should look something like this.

    images/WPT_Displaying_Images.gif